const Sequelize = require('sequelize')
const db = require('../db.js')
//把event表的字段映射成对象的属性,封装成Event对象
const Event = db.define(
  'Event',
  {
    id: { type: Sequelize.INTEGER, primaryKey: true, allowNull: false, autoIncrement: true },
    name: { type: Sequelize.STRING, allowNull: false },
    img: { type: Sequelize.STRING, allowNull: false },
    url: { type: Sequelize.STRING },
    articleId: { type: Sequelize.INTEGER },
  },
  {
    //是否支持驼峰命名 user_name userName
    underscored: true,
    //Event对象，对应的数据库表
    tableName: 'event',
  }
)
module.exports = Event
